﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using PowerBooking.RSE.Domain.Factories;
using PowerBooking.RSE.IRepository;
using PowerBooking.RSE.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PowerBooking.RSE.UnitTest
{
    [TestClass]
    public abstract class Test
    {
        private readonly Lazy<SpiderFactory> spiderFactory;
        private readonly Lazy<CityFactory> cityFactory;
        private readonly Lazy<FilterFactory> filterFactory;
        private readonly Lazy<RestaurantFactory> restaurantFactory;

        protected SpiderFactory SpiderFactory { get { return spiderFactory.Value; } }
        protected CityFactory CityFactory { get { return cityFactory.Value; } }
        protected FilterFactory FilterFactory { get { return filterFactory.Value; } }
        protected RestaurantFactory RestaurantFactory { get { return restaurantFactory.Value; } }

        public Test()
        {
            var unitOfWork = new UnitOfWork();
            spiderFactory = new Lazy<SpiderFactory>(() => new SpiderFactory(unitOfWork));
            cityFactory = new Lazy<CityFactory>(() => new CityFactory(unitOfWork));
            filterFactory = new Lazy<FilterFactory>(() => new FilterFactory(unitOfWork));
            restaurantFactory = new Lazy<RestaurantFactory>(() => new RestaurantFactory(unitOfWork));
        }
    }
}
